package com.admission.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.orm.Page;
import org.springside.modules.orm.PropertyFilter;

import com.admission.dao.OrderTempDao;
import com.admission.model.OrderTemp;

@Repository
@Transactional
public class OrderTempManager {

	private OrderTempDao orderTempDao;

	public OrderTempDao getOrderTempDao() {
		return orderTempDao;
	}

	@Autowired
	public void setOrderTempDao(OrderTempDao orderTempDao) {
		this.orderTempDao = orderTempDao;
	}
	
	/**
	 * 保存
	 * @param entity
	 * @throws Exception
	 */
	public void save(OrderTemp entity) throws Exception{
		orderTempDao.save(entity);
	}
	
	/**
	 * 通过filter分页查询
	 * @param page
	 * @param filters
	 * @return
	 */
	public Page<OrderTemp> getPageByFilter(Page<OrderTemp> page,
			List<PropertyFilter> filters) {
		return orderTempDao.findPage(page, filters);
	}
	
	/**
	 * 通过id找唯一对象，无返回null
	 * @param id
	 * @return
	 */
	public OrderTemp getOrderTempById(String id) {
  		return orderTempDao.findUniqueBy("id", id);
  	}
	
	/**
	 * 通过身份证号找唯一对象，无返回null
	 * @param id
	 * @return
	 */
	public OrderTemp getOrderTempByIdNum(String IdNum) {
  		return orderTempDao.findUniqueBy("idnum", IdNum);
  	}
	
	public void deleteById(String id){
		orderTempDao.delete(id);
	}
}
